import React from 'react';

const onClick = (props, value) => typeof props.onClick === 'function' && props.onClick(value);

export default props => (
  <div className="wea-doc-tab-path">
    <i className="icon-coms-LargeArea wea-doc-tab-path-text" onClick={() => onClick(props, {})} />
    {
      props.paths.map((data, index) => (
        <span className="wea-doc-tab-path-text" key={data.domid}>
          <span onClick={() => onClick(props, data)}>{data.name}</span>
          { index < props.paths.length - 1 && <i className="icon-coms-organization-right" /> }
        </span>
      ))
    }
  </div>
);
